<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h4>跨域jsonp</h4>
  <button>按钮</button>
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.6/axios.js"></script>
  <script>
    function fn(res){
      console.log(res,111)
    }
  </script>
  <script>
    // axios({
    //   url:'http://127.0.0.1:3000',
    //   method:'get',
    // }).then(res=>{
    //   //成功回调
    //   console.log(res)
    // })
    //通过点击事件发送请求 :动态创建script标签
    document.querySelector('button').addEventListener('click',()=>{
      const script=document.createElement('script')
      script.src='http://127.0.0.1:3000'
      console.log(script);
      document.body.append(script)
    })
  </script>
</body>
</html>